<?php

use yii\helpers\Html;
use yii\grid\GridView;
use leandrogehlen\treegrid\TreeGrid;

/* @var $this yii\web\View */
/* @var $searchModel common\models\DdCategorySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'Dd Categories';
$this->params['breadcrumbs'][] = $this->title;
?>
<div id="tabs-container" class="align-center">

    <ul class="nav nav-tabs">
        <li>
            <?= Html::a('添加分类', ['create'], ['class' => '']) ?>
        </li>
        <li class="active">
            <?= Html::a('分类管理', ['index'], ['class' => 'btn btn-primary']) ?>
        </li>
    </ul>
</div>
<div class="firetech-main"  style="margin-top:20px;">

    <div class="dd-category-index ">
        <?php // echo $this->render('_search', ['model' => $searchModel]);
        ?>
        <div class="panel panel-default">
            <div class="box-body">
                <?= TreeGrid::widget([
                    'dataProvider' => $dataProvider,
                    'keyColumnName' => 'category_id',
                    'parentColumnName' => 'parent_id',
                    'parentRootValue' => '0', //first parentId value
                    'pluginOptions' => [
                        'initialState' => 'collapsed',
                    ],
                    'columns' => [
                        ['class' => 'yii\grid\SerialColumn'],

                        'category_id',
                        'name',
                        'parent_id',
                        'image_id',
                        'sort',
                        //'wxapp_id',
                        //'create_time:datetime',
                        //'update_time:datetime',

                        ['class' => 'yii\grid\ActionColumn'],
                    ]
                ]);

                ?>
            </div>
        </div>
    </div>
</div>